<%@page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/taglib.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>${page.pageName}</title>
<%@include file="/common/public.jsp"%>
<link rel="stylesheet" type="text/css" href="${ctx}/css/main.css">
<link rel="stylesheet" type="text/css" href="${ctx}/css/query.css">
<script type="text/javascript">
window.Parent = window.dialogArguments;
window.Action = {};
Action.save = function(){
	jQuery("form:first").submit();
};
Action.complete = function( id ){
	if( jQuery("#id").val() == ""){
		jQuery("#id").val(id);//新增完成获取ID
		Parent["Action"].addQueryItem({value:id,text:jQuery("#itemName").val()});
	}
};
Action.queryConfigEdit = function( isAdd ){
	var id = isAdd ? "" : jQuery("#queryId").val();
	var url = '${ctx}/page/config/queryConfigEdit.do?configTypeId=2&id=' + id;
	Tools.window({args:window,width:800,height:600,url:url});
};
Action.addQueryConfig = function( o ){
	jQuery("#queryId").append("<option value='" + o.value + "'>" + o.text + "</option>");
};
</script>
</head>
<body>
<e:form name="EditForm" action="/page/config/queryItemSave.do">
<e:hidden name="id" value="${bean.itemId}"/>
<table class="etable">
	<tr>
		<td class="tl">条件名称：</td>
		<td class="tc">
			<e:text name="itemName" className="input" validate="{required:true,maxlength:128}" value="${bean.itemName}">
				<e:param name="defValue" value=""/>
			</e:text>
		</td>
		<td class="tl">条件参数名：</td>
		<td class="tc">
			<e:text name="itemCode" className="input" validate="{required:true,maxlength:128}" value="${bean.itemCode}">
				<e:param name="defValue" value=""/>
			</e:text>
		</td>
	</tr>
	<tr>
		<td class="tl">是否必选：</td>
		<td class="tc">
		<e:select name="itemCheck" className="input" validate="{required:true,maxlength:32}"  value="${bean.itemCheck}">
			<e:param name="source" value="json:[{text:'否',value:'0'},{text:'是',value:'1'}]"/>
			<e:param name="defValue" value="0"/>
		</e:select>
		</td>
		<td class="tl">自动查询：</td>
		<td class="tc">
		<e:select name="autoQuery" className="input" validate="{required:true,maxlength:32}"  value="${bean.autoQuery}">
			<e:param name="source" value="json:[{text:'是',value:'1'},{text:'否',value:'0'}]"/>
			<e:param name="defValue" value="0"/>
		</e:select>
		</td>
	</tr>
	<tr>
		<td class="tl">渲染类：</td>
		<td class="tc">
			<e:select name="className" className="input" validate="{required:true,maxlength:32}" value="${bean.className}">
				<e:param name="source" value="sql:select class_path value, class_name + '[' + class_path+ ']' text from item_class"/>
				<e:param name="defValue" value="com.th.cip.core.item.input.TextSimpleItem"/>
			</e:select>
		</td>
		<td class="tl">数据来源：</td>
		<td class="tc">
			<e:select name="queryId" className="input" validate="{required:false,maxlength:32}" value="${bean.queryId}" style="width:85%">
				<e:param name="source" value="sql:select a.QUERY_NAME text , a.QUERY_ID value from QUERY_CONFIG a where a.STATE='A' and a.CONFIG_TYPE_ID = 2"/>
				<e:param name="defValue" value="1"/>
			</e:select>
			<img src="${ctx}/image/add.gif" class="hand" onClick="Action.queryConfigEdit(true)"/>
			<img src="${ctx}/image/edit.gif" class="hand" onClick="Action.queryConfigEdit(false)"/>
		</td>
	</tr>
	<tr>
		<td class="tl">样式Style：</td>
		<td class="tc">
			<e:text name="cssStyle" className="input" validate="{required:false,maxlength:128}" value="${bean.cssStyle}">
			</e:text>
		</td>
		<td class="tl">样式Class：</td>
		<td class="tc">
			<e:text name="cssClass" className="input" validate="{required:false,maxlength:128}" value="${bean.cssClass}">
			</e:text>
		</td>
	</tr>
	<tr>
		<td class="tl">条件格式：</td>
		<td class="tc">
			<e:text name="itemFormat" className="input" validate="{required:false,maxlength:128}" value="${bean.itemFormat}">
			</e:text>
		</td>
	</tr>
	<tr>
	<td class="tl">默认值：</td>
		<td class="tc" colspan="3" width="90%">
			<e:textarea name="defValue" style="width:100%; height:120px" validate="{required:false,maxlength:128}" value="${bean.defValue}">
			</e:textarea>
		</td>
	</tr>
	<tr>
		<td align="center" colspan="4" height="30">
		<input id="SaveButton" type="button" class="btn_orange_b2" value="保 存" onClick="Action.save()"/>
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input id="SaveButton" type="button" class="btn_blue_b2" value="关 闭" onClick="window.close()"/>
		</td>
	</tr>
</table>
</e:form>
</body>
</html>